const { defineConfig } = require("@vue/cli-service");
const SetupMock = require('./mock/index')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    open: true,
    host: "localhost",
    proxy: {
      "/api": {
        target: "http://sph-h5-api.atguigu.cn",
        changeOrigin: true,
      },
    },
    onBeforeSetupMiddleware: function (devServer) {
      // 获取app，此处的app相当于 app = express() 也即express实例
      const app = devServer.app
      // 将app实例通过参数传递过去
      SetupMock(app)
    },
  },
});
